package com.atguigu.search;

import com.atguigu.utils.ArrayGenerator;

public class LinearSearchTest {

    public static void main(String[] args) {
        int[] dataSize={100000,1000000};
        for(int n: dataSize) {
            Integer[] arr = ArrayGenerator.generateOrderArray(n);

            long startTime = System.nanoTime();
            for (int i = 0; i < 100; i++) {
                LinearSearch.Search(arr, n);
            }
            long endTime = System.nanoTime();
            double time = (endTime - startTime) / 1000000000.0;
            System.out.println("n = " + n + "，100 runs：" + time + "s");
        }

    }
}
